<template>
<div style="display: flex;line-height: 60px;font-size: 12px;">
    <div style= "flex: 1;font-size:20px;margin-bottom: 10px;">
        <span
            :class= "collapseBtnClass"
            style= "cursor: pointer"
            @click= "collapse"
        ></span>
            <!--页签-->
        <el-breadcrumb separator="/"  style= "display: inline-block; margin-left: 20px" >
            <el-breadcrumb-item :to= "{path:'/'}" >首页</el-breadcrumb-item>
            <el-breadcrumb-item >{{ currentPathName }}</el-breadcrumb-item>
            <!--标签是动态的-->
        </el-breadcrumb>
    </div>
    <el-dropdown style= "width: 70 px; cursor: pointer">
        <span>{{teacher.nickName}}</span>


        <i class= "el-icon-arrow-down" style= "margin-left: 5px"></i>
        <!--            <i class= "el-icon-setting" style= "margin-right: 15px"></i>-->
        <el-dropdown-menu slot= "dropdown" >
            <el-dropdown-item >
            <span  style="text-decoration:none" @click= "PersonInfo">用户信息</span>
            </el-dropdown-item>
            <el-dropdown-item >
            <span  style="text-decoration:none" @click= "logOff">退出</span>
            </el-dropdown-item>
        </el-dropdown-menu>
    </el-dropdown>
</div>  
</template>


<script>
export default{

name:"Aside",
data(){
    return{
        teacher:localStorage.getItem('teacher') ? JSON.parse(localStorage.getItem("teacher")):{}
    }

},
props :{
        collapseBtnClass:String,
        collapse:Boolean,
        pathName:String,
        teacherName:String 
    },
    computed:{
        currentPathName(){
            return this.$store.state.currentPathName;
        },
        // handleTeacherName(){
        //     return localStorage.teacherName
        // }
    },
    watch: {
        '$route':function(){
            this.currentPathName = localStorage.getItem("currentPathName") //取出route里面设置的当前路由信息
        }
    },
    methods:{
        logOff(){
            this.$router.push("/login")
            localStorage.removeItem("teacher")
            // localStorage.removeItem("authorityList")
            this.$message.success("退出成功！")
        },
        PersonInfo(){
            this.$router.push("/PersonInfo")
        }
    }
    // created(){
    // console.log(this.$route)
    // }
}
</script>

<style scoped>

</style>


